package com.ruoyi.instrumentation.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.instrumentation.mapper.UsageDetailsMapper;
import com.ruoyi.instrumentation.domain.UsageDetails;
import com.ruoyi.instrumentation.service.IUsageDetailsService;

/**
 * 使用明细Service业务层处理
 * 
 * @author hj
 * @date 2025-01-13
 */
@Service
public class UsageDetailsServiceImpl implements IUsageDetailsService 
{
    @Autowired
    private UsageDetailsMapper usageDetailsMapper;

    /**
     * 查询使用明细
     * 
     * @param usageId 使用明细主键
     * @return 使用明细
     */
    @Override
    public UsageDetails selectUsageDetailsByUsageId(Long usageId)
    {
        return usageDetailsMapper.selectUsageDetailsByUsageId(usageId);
    }

    /**
     * 查询使用明细列表
     * 
     * @param usageDetails 使用明细
     * @return 使用明细
     */
    @Override
    public List<UsageDetails> selectUsageDetailsList(UsageDetails usageDetails)
    {
        return usageDetailsMapper.selectUsageDetailsList(usageDetails);
    }

    /**
     * 新增使用明细
     * 
     * @param usageDetails 使用明细
     * @return 结果
     */
    @Override
    public int insertUsageDetails(UsageDetails usageDetails)
    {
        usageDetails.setCreateTime(DateUtils.getNowDate());
        return usageDetailsMapper.insertUsageDetails(usageDetails);
    }

    /**
     * 修改使用明细
     * 
     * @param usageDetails 使用明细
     * @return 结果
     */
    @Override
    public int updateUsageDetails(UsageDetails usageDetails)
    {
        usageDetails.setUpdateTime(DateUtils.getNowDate());
        return usageDetailsMapper.updateUsageDetails(usageDetails);
    }

    /**
     * 批量删除使用明细
     * 
     * @param usageIds 需要删除的使用明细主键
     * @return 结果
     */
    @Override
    public int deleteUsageDetailsByUsageIds(Long[] usageIds)
    {
        return usageDetailsMapper.deleteUsageDetailsByUsageIds(usageIds);
    }

    /**
     * 删除使用明细信息
     * 
     * @param usageId 使用明细主键
     * @return 结果
     */
    @Override
    public int deleteUsageDetailsByUsageId(Long usageId)
    {
        return usageDetailsMapper.deleteUsageDetailsByUsageId(usageId);
    }
}
